abstract class Animal
{
    public abstract void eat();
}
interface Afraid
{
    void escape();
    void makeSounds();
}
class Dog extends Animal implements Afraid
{
    @Override
    public void eat()
    {
        System.out.println("开胃萝卜");
    }
    @Override
    public void escape()
    {
        System.out.println("狗窜");
    }
    @Override
    public void makeSounds()
    {
        System.out.println("别狗叫");
    }
}
class Cat extends Animal implements Afraid
{
    @Override
    public void eat()
    {
        System.out.println("哈基米窝~");
    }
    @Override
    public void escape()
    {
        System.out.println("曼波~");
    }
    @Override
    public void makeSounds()
    {
        System.out.println("南北绿豆~");
    }
}
class Person
{
    public void feedAnimal(Animal animal)
    {
        animal.eat();
    }

    // 捕捉动物，参数为Afraid类型
    public void catchAnimal(Afraid afraid)
    {
        afraid.escape();
        afraid.makeSounds();
    }
}
public class Main
{
    public static void main(String[] args)
    {
        Animal dog = new Dog();
        Animal cat = new Cat();

        Person person = new Person();
        System.out.println("喂个dog和哈基米：");
        person.feedAnimal(dog);
        person.feedAnimal(cat);

        System.out.println("\n捕捉我的dog和哈基米：");
        person.catchAnimal((Afraid) dog);
        person.catchAnimal((Afraid) cat);
    }
}